package cn.edu.lzzy;
import cn.edu.*;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;


public class TextRoleSkillsComparator {
    public static void main(String[] args) {
        GameCharacters o1=new GameCharacters(200);
        GameCharacters o2=new GameCharacters(150);
        GameCharacters o3=new GameCharacters(230);

        GameCharacters g =
//                比较技能伤害
                max(o1, o2, new RoleSkillsComparator());


        List<GameCharacters> GameCharacters=new ArrayList<GameCharacters>();
        GameCharacters.add(o1);
        GameCharacters.add(o2);
        GameCharacters.add(o3);

//        升序排序
        Collections.sort(GameCharacters,new RoleSkillsComparator());
//        Collections.reverse(GameCharacters);
//        Collections.max(GameCharacters,new RoleSkillsComparator());

//        遍历列表
        for (GameCharacters item:GameCharacters
        ) {
            System.out.println(item.SkillDamage());
        }
    }



    public static GameCharacters max(GameCharacters g1,
                                     GameCharacters g2, Comparator<GameCharacters> c) {
        if (c.compare(g1, g2) > 0)
            return g1;
        else
            return g2;
    }
}
